package com.kangwan.cs.imp;

import com.kangwan.cs.dao.StudentDao;
import com.kangwan.cs.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class StudentDaoImpl implements StudentDao {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public void addStu(Student student) {
        mongoTemplate.save(student);
    }

    @Override
    public List<Student> listStu() {

        return mongoTemplate.findAll(Student.class);
    }
}
